package com.gitee.cui.client.sender;

import com.gitee.cui.client.builder.LoginMsgBuilder;
import com.gitee.cui.common.common.bean.msg.ProtoMsg;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 登录发送器
 * @author cuiqingqiang
 * @version 1.0
 * @date 2021/10/27 15:13
 **/
@Slf4j
@Service
public class LoginSender extends BaseSender {

    /**
     * 发送登录请求
     */
    public void sendLoginMsg() {
        if (!isConnected()) {
            log.info("还没有建立连接！");
            return;
        }
        log.info("构造登录消息");
        ProtoMsg.Message message = LoginMsgBuilder.buildLoginMsg(getUser(), getSession());
        log.info("发送登陆消息");
        super.sendMsg(message);
    }
}
